import "pkl:test"

class Person {
  name: String(length.isBetween(10, 20))
}

class Person2 {
  alternativeNames: Listing<String>(!isEmpty)
}

res1 = new Person {
  name = "Linda Forth"
}

res2 = test.catch(() ->
  new Person {
    name = "Pigeon"
  }.name
)

res3: Person2 = new {
  alternativeNames = new {
    "Parrot"
  }
}

res4 = test.catch(() ->
  new Person2 {
    alternativeNames {}
  }.alternativeNames
)
